/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.jome.ctrlview.bidim;

/**
 *
 * @author Mr.Sam
 */
import java.awt.*;
import fr.ove.openmath.jome.ctrlview.bidim.*;
import fr.ove.openmath.jome.model.*;

/**
* Layout manager that lays the display of an operator whose symbol is located between its 2 operands.<BR>
* Rendering is done vertically, the first operand on top, the symbol in the middle and the second operand
* under the 2 previous.<BR>
* The symbol is rendered with an image.
*
* @author © 1999 DIRAT Laurent
* @version 2.0 15/12/1999
*/
public class ImageBetweenOperatorLayout extends BetweenOperatorLayout {
    /**
    * The symbol we have to insert between each component if necessary.
    */
    private ImageSymbol symbolOperator = null;
    
    /**
    * Returns the display of the operator
    */
    public Display createOperatorDisplay() {
        if (symbolOperator == null) {
            Operator fts = (Operator) displayToLay.getListener();
            //symbolOperator = new ImageSymbol(fts.getTheOperator(), displayToLay);
            symbolOperator = new ImageSymbol(fts.getResourceIdentifier(), displayToLay);
        }
        
        // On créé un display pour l'opérateur.
        SymbolDisplay operatorDisplay = new SymbolDisplay(displayToLay.getGraphicContext(), symbolOperator);
        operatorDisplay.setIsSymbolOperatorDisplay(true);
        
        return operatorDisplay;
    }
}
